<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<html>
<head>
	<title>订单一览</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出用户数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/orders/tOrders/export");
						$("#searchForm").submit();
						$("#searchForm").attr("action","${ctx}/orders/tOrders/busOrderList");
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
		});
		function page(n, s) {
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
			return false;
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/orders/tOrders/busOrderList">订单一览</a></li>
		<shiro:hasPermission name="realsche:tRealsche:view">
			<li><a href="${ctx}/realsche/tRealsche/dispatchedlist">已调度</a></li>
		</shiro:hasPermission>
	</ul>
	<form:form id="searchForm" action="${ctx}/orders/tOrders/busOrderList" modelAttribute="TOrders" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<table class="table table-condensed" style="width: 100%;">
		<tr class="success"><td>
		<ul class="ul-form">
			<li>
				<span><label>订单名称：</label></span>
				<form:input path="ordername" class="input-medium"/>
			</li>
			<li>
				<span><label>订单号：</label></span>
				<form:input path="orderid" class="input-medium"/>
			</li>
			<li>
				<span><label>&nbsp;&nbsp;订单日期：</label></span>
				<input type="text" id="createDateQueryStart" name="createDateQueryStart" maxlength="20" readonly class="input-small Wdate"
					value="${tOrders.createDateQueryStart }"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,maxDate:'#F{$dp.$D(\'createDateQueryEnd\')}'});"/>
				至&nbsp;
				<input type="text" id="createDateQueryEnd" name="createDateQueryEnd" maxlength="20" readonly class="input-small Wdate"
					value="${tOrders.createDateQueryEnd }"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,minDate:'#F{$dp.$D(\'createDateQueryStart\')}'});"/>
			</li>
			<li>
				<span><label>&nbsp;&nbsp;订单状态：</label></span>
				<form:select path="orderstatus" class="input-medium">
					<option value="">全部</option>
					<form:options items="${fns:getDictList('orderstatus')}"
						itemLabel="label" itemValue="value" htmlEscape="false" />
				</form:select>
			</li>
			<li>
				<span><label>&nbsp;&nbsp;发车日期：</label></span>
				<input type="text" id="departdate" name="departdateStr" maxlength="20" readonly class="input-medium Wdate"
					value="${tOrders.departdateStr }"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
			</li>
			<li>
			<span><label>&nbsp;&nbsp;选择车型：</label></span>
			<select id="cartype" name="cartype.cargotypeid" class="input-medium">
				<option value="">全部</option>
				<c:forEach items="${tCargotypeList}" var="cartype">
					<option value="${cartype.cargotypeid}"
						<c:if test="${cartype.cargotypeid eq tOrders.cartype.cargotypeid}">selected="selected"</c:if>>
							${cartype.typename}</option>
					</c:forEach>
			</select>
			</li>
			<li class="btns">
				<input class="btn btn-primary btn-success" type="submit" value="查询"/>
				<shiro:hasPermission name="orders:bus:export">
				<input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
				</shiro:hasPermission>
			</li>
			<li class="clearfix"></li>
		</ul>
		</td></tr>
	</table>
	</form:form>
	<sys:message content="${message}"/>
	<table class="table table-striped table-bordered table-condensed">
		<thead>
			<tr class="success">
				<th>订单号</th>
				<th>订单名称</th>
				<th>订单日期</th>
				<th>发车日期</th>
				<th>结束日期</th>
				<th>车型</th>
				<th>辆数</th>
				<th>订单状态</th>
				<th>处理原因</th>
				<th>联系人</th>
				<th>联系方式</th>
				<th>归属</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="orders">
			<tr>
				<td>${orders.orderid }</td>
				<td>${orders.ordername }<c:if test="${orders.istrouble == '1' }"><font title="${orders.reason }"><img src="${ctxStatic }/xiake/images/warn.png"/></font></c:if></td>
				<td><fmt:formatDate value="${orders.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${orders.departdate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td>${orders.endtime}</td>
				<td>${orders.cartype.typename}</td>
				<td>${orders.purchasenum}</td>
				<td>${fns:getDictLabel(orders.orderstatus, 'orderstatus', '无')}
				<td>${fns:getDictLabel(orders.settlereason, 'settlereason', '无')}
				<td>${orders.contacts}</td>
				<td>${orders.payertel}</td>
				<td>
					<c:if test="${orders.ordertype ne '7' }">线上</c:if>
					<c:if test="${orders.ordertype eq '7' }">线下</c:if>
				</td>
				<td>
				<shiro:hasPermission name="orders:bus:view">
					<a href="${ctx}/orders/tOrders/busOrdersForm?id=${orders.orderid}">查看</a>
					<shiro:hasPermission name="realsche:tRealsche:view">
						<c:if test="${orders.orderstatus eq '0' and orders.realsche.dispstatus eq '1'}">
							&nbsp;<a href="${ctx}/realsche/tRealsche/rentdispform?id=${orders.realscheid}">调度</a>
						</c:if>
					</shiro:hasPermission>
					<shiro:hasPermission name="orders:plat:edit">
						<c:if test="${orders.ordertype ne '5' }">
							&nbsp;<a href="${ctx}/orders/tOrders/troubleform?id=${orders.orderid}&t=1">标记问题订单</a>
						</c:if>
					</shiro:hasPermission>
				</shiro:hasPermission>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>